package com.ruoyi.system.enums;

/**
 * H5用户状态枚举
 */
public enum H5UserStatusEnum {

    /**
     * 正常
     */
    NORMAL("0", "正常"),

    /**
     * 停用
     */
    DISABLED("1", "停用"),

    /**
     * 未验证手机号
     */
    UNVERIFIED("2", "未验证手机号");

    private final String code;
    private final String desc;

    H5UserStatusEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据代码获取枚举
     */
    public static H5UserStatusEnum getByCode(String code) {
        if (code == null) {
            return null;
        }
        for (H5UserStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }

    /**
     * 根据描述获取枚举
     */
    public static H5UserStatusEnum getByDesc(String desc) {
        if (desc == null) {
            return null;
        }
        for (H5UserStatusEnum status : values()) {
            if (status.getDesc().equals(desc)) {
                return status;
            }
        }
        return null;
    }
}
